public class TheMaxContainerOfWater {
    // 盛最多水的容器 https://leetcode.cn/problems/container-with-most-water/description/
    public int maxArea(int[] height) {
        int maxVal=0;
        int left=0;
        int right=height.length-1;
        while(left!=right) {
            int val=Math.min(height[left],height[right])*(right-left);
            if(val>maxVal) {
                maxVal=val;
            }
            if(height[left]>height[right]) {
                right--;
            }else {
                left++;
            }
        }
        return maxVal;
    }
}
